package com.flong.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.flong.entity.User;
import com.flong.utils.BaseMapper;

@Mapper
public interface IUserMapper extends BaseMapper<String, User> {

	public List<User> getUserList(Integer id);

	@Delete("drop table T_USER if exists")
	void dropTable();

	@Insert("create table T_USER (id bigint generated by default as identity, USERNAME varchar(255), PASSWORD varchar(255), primary key (id))")
	void createTable();

	@Insert("insert into T_USER (userName,passWord) values(#{userName},#{passWord})")
	int insert(User user);

	@Delete("delete from T_USER Where id=#{id}")
	void deleteById(Integer id);

	@Select("select id,userName,passWord  from T_USER ")
	List<User> findAll();
	
	@Select("select id,userName,passWord from T_USER where userName like #{userName}")
    List<User> findByNameLike(String userName);
	
	
	@Select("select id,userName,passWord from T_USER where userName like #{userName}")
	/*
	@Results
	({  
        @Result(id=true,column="id",property="id"),  
        @Result(column="userName",property="userName"),  
        @Result(column="passWord",property="passWord"),  
    })  
    */
    User findByUserName(String userName);
	

}
